package servletContext;


import java.io.IOException;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Servlet2 extends HttpServlet {
	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		//获得上下文
		ServletContext sc = getServletContext();
		//取出数据
		String lock=(String) sc.getAttribute("key");
		System.out.println(lock);
	}
}
